<?
define('_VIEW_MODEL_','default');
require_once './init.php';
header("Content-type:text/vnd.wap.wml;charset=utf-8");
$id = intval($id);
$no = intval($auid);
$friend="";
$error = "";
if(isset($act)&&$act == "error"){
	$error = "你当前有一本没有到达10万字";
}
if(isset($act)&&$act == "allow"){
	header("Location:addnovel.php?id=$id");
	exit;
}
$rs = $db->Execute("select * from {$telper}novel where `authid` = '$id'");
//echo "select * from {$telper}novel where `authid` = '$no'";
$novel = $rs->GetArray();
foreach($novel as $k=>$v){
	if($v['wordnum'] < 100000){
		$addnew = "error";
	}else{
		$addnew = "allow";
	}
}
$tim = time();
//print_r($novel);
$rf = $db->Execute("select `title`,`link` from {$telper}friendlink where state = 0 order by rank desc");
$friendinfo = $rf ->GetArray();
foreach($friendinfo as $k=>$v){
	$friend .="<a href='$v[link]'>$v[title]</a>";
	$k = $k+1;
	if($k%4 ==0 && count($friend)%4 != 0){
		$friend .="<br/>";
	}
	if($k%4 !=0 && count($friendinfo)>$k){
		$friend .=".";
	}
}
$smartyObj->assign('friendlink',$friend);
$smartyObj->assign("id",$id);
$smartyObj->assign("auid",$no);
$smartyObj->assign("time",$tim);
$smartyObj->assign("novel",$novel);
$smartyObj->assign("stat",$addnew);
$smartyObj->assign("erro",$error);
$smartyObj->display("authorpage.tpl");
?>